package com.hzcx.app.simplechat.ui.publicui.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.base.BaseEmptyBean;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.LoginModel;
import com.hzcx.app.simplechat.model.PublicModel;
import com.hzcx.app.simplechat.model.UserModel;
import com.hzcx.app.simplechat.ui.login.bean.LoginInfoBean;
import com.hzcx.app.simplechat.ui.publicui.contract.CaptureContract;
import com.hzcx.app.simplechat.ui.publicui.contract.SendCodeContract;
import com.hzcx.app.simplechat.ui.user.bean.UserInfoBean;

public class CapturePresenter extends BasePresenter<CaptureContract.View> implements CaptureContract.Presenter {

    /**
     *  根据二维码获取用户信息
     * @param context
     * @param url
     */
    @Override
    public void getUserInfoByQrCode(Context context, String url) {
        UserModel.getUserInfoByQrCode(context, url, new BaseDialogObserver<UserInfoBean>(context) {
            @Override
            protected void onSuccess(UserInfoBean data) {
                mView.userInfoResult(data);
            }

            @Override
            public void onFailure(Throwable e, String errorMsg) {
                super.onFailure(e, errorMsg);
                mView.onFail();
            }
        });
    }
}
